<?php

$title = 'All Product';
$this->headTitle($title);
?>
<div class="panel panel-primary">
    <div class="panel-heading">
	<h4><?php echo $this->escapeHtml($title); ?></h4>
    </div>
    <div class="panel-body">
	<p>
	    <a class="btn btn-info" href="<?php echo $this->url('product', array('action' => 'add')); ?>">Add new product</a>
	</p>
	<table class="table">
	    <tr>
		<th>Product name</th>
		<th>Manufacture</th>
		<th>Price</th>
		<th>Disabled</th>
		<th>&nbsp;</th>
	    </tr>
	    <?php foreach ($products as $product) : ?>
	    <tr>
		<td>
		    <a href="<?php echo $this->url('product', array(
			'action' => 'detail', 'id' => $product->id)); ?>">
		    <?php echo $this->escapeHtml($product->name); ?>
		    </a>
		</td>
		<td><?php echo $this->escapeHtml($product->manufacture); ?></td>
		<td><?php echo number_format($product->price); ?> VND</td>
		<td><input type="checkbox" disabled="disabled" class="disabled checkbox" <?php
					    if ($product->disabled == 1) {
						echo 'checked="checked"';
					    } ?> />
		</td>
		<td>
		    <a class="btn btn-success" href="<?php echo $this->url('product', array(
			'action' => 'edit', 'id' => $product->id)); ?>">Edit</a>
		    <a class="btn btn-warning" href="<?php echo $this->url('product', array(
			'action' => 'delete', 'id' => $product->id)); ?>">Delete</a>
		</td>
	    </tr>
	    <?php endforeach; ?>
	</table>
    </div>
</div>